-- print("hello world!!!")

seterrorhandler(print)

print('loaded Zhangyu.lua')
UIErrorsFrame:Show()
F=F or CreateFrame("frame")

local files = {}
files[41] = "dz_cisha.lua"
files[42] = "dz_zhandou.lua"
files[43] = "dz_minrui.lua"
files[32] = "lr_sheji.lua"
files[33] = "lr_shengcun.lua"
files[23] = "sq_chengjie.lua"
files[82] = "mage_fire.lua"
files[11] = "zs_wuqi.lua"
files[13] = "zs_fangyu.lua"
files[63] = "dk_xiee.lua"
files[91] = "ss_tongku.lua"
function getActiveSchemeIdx()
	local _,_,classid = UnitClass('player')
	return classid * 10 + GetSpecialization()
end

LoadScript("GlobalFunc.lua")
LoadScript("events.lua")
LoadScript("Example.lua")
LoadScript("macro.lua")
LoadScript("commfuncs.lua")
LoadScript("Util.lua")
LoadScript("fiber.lua")

-- LoadScript("test.lua")

print('getActiveSchemeIdx() == ', getActiveSchemeIdx())
s = LoadScript(files[getActiveSchemeIdx()])

editWowMacro('load', [[
/load Zhangyu.lua
]])

editWowMacro('start', [[
/startattack
/run ut.attack()
]])

editWowMacro('stop', [[
/stopattack
/run ut.stop()
]])

editWowMacro('aoe', [[
/use 13
/use 14
/startattack
/run ut.aoe()
]])

editWowMacro('interrupt', [[
/run ut.interrupt()
]])



function stopMove()
    MoveBackwardStop(0)
    MoveForwardStop(0)
    StrafeLeftStop(0)
    StrafeRightStop(0)
end
-- SetBindingMacro("W", editWowMacro('forward', [[
-- /run stopMove()
-- /run MoveForwardStart(0)
-- ]]))

-- SetBindingMacro("S", editWowMacro('backward', [[
-- /run stopMove()
-- //run MoveBackwardStart(0)
-- ]]))

-- SetBindingMacro("A", editWowMacro('leftward', [[
-- /run stopMove()
-- /run StrafeLeftStart(0)
-- ]]))

-- SetBindingMacro("D", editWowMacro('rightward', [[
-- /run stopMove()
-- /run StrafeRightStart(0)
-- ]]))

-- SetBindingMacro("D", editWowMacro('forward', [[
-- /run StrafeRightStart(0)
-- ]]))

hooksecurefunc( "JumpOrAscendStart", function()
 -- DEFAULT_CHAT_FRAME:AddMessage( "Jump" );
 -- MoveForwardStart(0)
 -- ToggleAutoRun()
end);

-- hooksecurefunc( "MoveBackwardStart", function()
--  -- DEFAULT_CHAT_FRAME:AddMessage( "Jump" );
--  MoveForwardStop(0)
--  -- MoveBackwardStart(0)
-- end);


SaveBindings(1)
SaveBindings(2)


-- SetHackEnabled(Hacks.AlwaysFacing, true)

--		LoadScript("sq_chengjie.lua")
--		LoadScript("dk_xiee.lua")
--		LoadScript("dk_bing.lua")
--		LoadScript("mage_ice.lua")
--		LoadScript("mage_fire.lua")
--		LoadScript("ss_tongku.lua")
--		LoadScript("ss_huimie.lua")
--		LoadScript("dz_cisha.lua")
--		LoadScript("dz_zhandou.lua")
--		LoadScript("dz_minrui.lua")
--		LoadScript("lr_shouwang.lua")
--		LoadScript("lr_shengcun.lua")
--		LoadScript("zs_wuqi.lua")
--		LoadScript("zs_jiaodou.lua")
--		LoadScript("zs_kuangbao.lua")
--		LoadScript("follow.lua")
		
		-- LoadScript("Zhangyu.lua")

